import { getPlaylistTrackAll_api } from '@/api/homePage'
import Utils from '@/utils/commonUtils'
import { ref } from 'vue'
export default function usePlaylistApi() {
    const playList = ref<any>([])
    const loading = ref<boolean>(false)
    const getPlaylist = (id: string) => {
        loading.value = false
        getPlaylistTrackAll_api({ id, limit: 3 }).then((response: any) => {
            playList.value = response.songs
        }).catch(() => {
            Utils.openNotification('error', "请求失败，稍后再试")
        }).finally(() => {
            loading.value = true
        })
    }
    return {
        getPlaylist,
        playList,
        loading
    }
}